
#initialize
library(class)
library(e1071)
source("./config")
source("./fun.R")

# Support Vector Machines
SVM.cl <- svm(Topic ~., data = r.train, kernel = svm_kernel, cost = svm_C, gamma = svm_gamma)
SVM.pr <- predict(SVM.cl, r.test[,-n])

# Error rate
SVM.er <- sum(as.character(r.test[,n]) == as.character(SVM.pr))/length(r.test[,n])

# other quality measures
SVM.sen <- sensitivity_M(as.character(r.test[,n]), as.character(SVM.pr))
SVM.spe <- specificity_M(as.character(r.test[,n]), as.character(SVM.pr))
SVM.fm <- Fmeasure(as.character(r.test[,n]), as.character(SVM.pr))
SVM.ta <- TA(as.character(r.test[,n]), as.character(SVM.pr))

